734f265b9f31422cbe6e65b0fdd1e3bf42c1cfbc,javascript-frontend/src/main/java/org/sonar/javascript/se/sv/PlusSymbolicValue.java,PlusSymbolicValue,baseConstraint,#ProgramState#,54

Before Change


    Set<Type> numberTypes = EnumSet.of(Type.NUMBER, Type.BOOLEAN);

    Type firstType = state.getConstraint(firstOperandValue).type();
    Type secondType = state.getConstraint(secondOperandValue).type();

    if (firstType != null || secondType != null) {
      if (firstType == Type.STRING || secondType == Type.STRING) {

After Change


    Constraint numberOrBoolean = Constraint.NUMBER_PRIMITIVE.or(Constraint.BOOLEAN_PRIMITIVE);

    Constraint firstConstraint = state.getConstraint(firstOperandValue);
    Constraint secondConstraint = state.getConstraint(secondOperandValue);

    if (firstConstraint.isStricterOrEqualTo(Constraint.ANY_STRING) || secondConstraint.isStricterOrEqualTo(Constraint.ANY_STRING)) {
      return Constraint.STRING_PRIMITIVE;

    } else if (firstConstraint.isStricterOrEqualTo(numberOrBoolean) && secondConstraint.isStricterOrEqualTo(numberOrBoolean)) {